#ifndef _h_imagedata
#define _h_imagedata

#include <vector>

class image_data
{
private:
	int label;
	int channels;
	int height, width;
	int ***a;
	void init_a();
public:
	image_data(int channels, int height, int width);
	image_data(const image_data &img);
	~image_data();
	void operator =(const image_data &tmp);
	void set_label(int label);
	void set_pixel(int channel, int pos_x, int pos_y, int pixel);
	int get_pixel(int channel, int pos_x, int pos_y) const;
	int get_label() const;
	int get_channels() const;
	int get_height() const;
	int get_width() const;
	int get_size() const;
	void read_bmp(const char *fname);
	void extract_patch(int x, int y, int rf_size, double *p) const;
};

class image_data_set
{
private:
	std::vector<image_data> img;
public:
	image_data& operator [](int i);
	int size();

	// return number of images read
	int load_bin(const char *fname);
	int load_t200(const char *fname); 
	int load_txt(const char *fname); 
	int load_bmp(const char *path, int max_id); // only read "path\0.bmp" .. "path\max_id.bmp"
	int load_bmp_list(const char *list_file);

	void save_bin(const char *fname);
	void save_t200(const char *fname);
	void save_txt(const char *fname);
};

#endif
